package com.egao.common.remark.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.egao.common.remark.entity.TLikes;
import com.egao.common.remark.mapper.TLikesMapper;
import com.egao.common.remark.service.ITLikesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @auther ZhaoPeng Wang
 * @create 2022-03-28 16:11:09
 * @description 服务实现类
 */
@Service
public class TLikesServiceImpl extends ServiceImpl<TLikesMapper, TLikes> implements ITLikesService {
    @Autowired
    TLikesMapper tLikesMapper;

    @Override
    public Integer getRemarkLikesNumber(Integer remarkId,Integer type) {
        QueryWrapper<TLikes> wrapper = new QueryWrapper<>();
        wrapper.eq("remark_id",remarkId)
                .eq("type",type);
        List<TLikes> tLikes = tLikesMapper.selectList(wrapper);
        return tLikes.size();
    }
}
